package com.cat.dataStructure03;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/contest/weekly-contest-476/problems/minimum-string-length-after-balanced-removals/
 * @create 2025/11/16 10:31
 * @since JDK17
 */

public class Solution67 {
    public int minLengthAfterRemovals(String s) {
        int cnt1 = 0, cnt2 = 0;
        for (var x : s.toCharArray()) {
            if (x == 'a') cnt1++;
            else  cnt2++;
        }
        return Math.abs(cnt1 - cnt2);
    }
}
